package com.example.ceshi.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.List;

import lombok.Data;

/**
 * 用户推广关系表
 * @TableName user_spread
 */
@TableName(value ="user_spread")
@Data
public class UserSpread implements Serializable {
    /**
     * 
     */
    @TableId(type = IdType.AUTO)
    private Integer id;

    /**
     * 用户uid
     */
    private Integer uid;

    /**
     * 推广人uid
     */
    private Integer spreadUid;

    /**
     * 推广时间
     */
    private Integer spreadTime;

    @TableField(exist = false)
    private List<UserSpread> children;

    @TableField(exist = false)
    private boolean isSelect;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserSpread other = (UserSpread) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
            && (this.getUid() == null ? other.getUid() == null : this.getUid().equals(other.getUid()))
            && (this.getSpreadUid() == null ? other.getSpreadUid() == null : this.getSpreadUid().equals(other.getSpreadUid()))
            && (this.getSpreadTime() == null ? other.getSpreadTime() == null : this.getSpreadTime().equals(other.getSpreadTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUid() == null) ? 0 : getUid().hashCode());
        result = prime * result + ((getSpreadUid() == null) ? 0 : getSpreadUid().hashCode());
        result = prime * result + ((getSpreadTime() == null) ? 0 : getSpreadTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", uid=").append(uid);
        sb.append(", spreadUid=").append(spreadUid);
        sb.append(", spreadTime=").append(spreadTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append(", children=").append(children);
        sb.append(", isSelect=").append(isSelect);
        sb.append("]");
        return sb.toString();
    }
}